/*
 * nume: file-list.h
 * autor: Alex
 * descriere: info despre client
 * tabela de modificarei
 *   23 mai 2007 - Alex - prima versiune
 *   24 mai 2007 - Dan - adugat header comment
 *   01 iunie 2007 - ~D - modificat connect
 */

#ifndef CLIENT_INFO_H_
#define CLIENT_INFO_H_

#include "file-list.h"
#include "client-id.h"
#include <QtCore>

class FileList;

class ClientInfo {
public:
    ClientInfo() ;

    ~ClientInfo() ;
    
    // genereaza un id random
    void generate_random_id();

    void set_id(ClientId id) {
        id_ = id;
    }

    ClientId id() const {
        return id_;
    }

    void set_ip(quint32 ip) {
        ip_ = ip;
    }

    quint32 ip() const {
        return ip_;
    }

    void set_port(quint16 port) {
        port_ = port;
    }

    quint16 port() const {
        return port_;
    }

    void set_name(const QByteArray& name) {
        name_ = name;
    }

    void set_email(const QByteArray& email) {
        email_ = email;
    }

    const FileList* filelist() const {
        return filelist_;
    }

    FileList* mutable_filelist() const {
        return filelist_;
    }

private:
    ClientId id_;         // identificator clientului, 64 biti
    quint32 ip_;          // ip in network byte order
    quint16 port_;        // upd port in network byte order

    QByteArray name_;
    QByteArray email_;

    FileList* filelist_;  // lista cu fisiere a clientului
                          // daca == NULL, atunci
                          // clientul nu are nici o lista
};

#endif  // CLIENT_INFO_H_
